﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;

namespace IHISCETeim.Web.MachineSys.UserModel
{
    public partial class U4008RecordToJiReport : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "U4008RecordToJiReport";
            }
        }
        #region 属性 (查询条件)

        protected bool ShowTimeInput
        {
            get
            {
                return GetRequestValue<bool>("ShowTimeInput", true);
            }
        }
        protected string CreateDateFrom
        {
            get
            {
                return ShowTimeInput ? "" : GetRequestValue<string>("CreateDateFrom", "");
            }
        }

        protected string CreateDateTo
        {
            get
            {
                string _temp = ShowTimeInput ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : GetRequestValue<string>("CreateDateTo", "");

                return CreateDateFrom.IsEmptyOrNull() ? "" : _temp.IsEmptyOrNull() ? Convert.ToDateTime(CreateDateFrom).AddDays(1).ToString("yyyy-MM-dd") : _temp;

                //  return _temp.IsEmptyOrNull() ? CreateDateFrom.IsEmptyOrNull() ? "" : Convert.ToDateTime(CreateDateFrom).AddDays(1).ToString("yyyy-MM-dd") :  CreateDateFrom.IsEmptyOrNull()?"":_temp;
            }
        }



        #endregion
        protected DataTable SUMDT = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTableCollection dt = U4008RecordController.GetToJiReport(CreateDateFrom, CreateDateTo);
            this.rpMenu.DataSource = dt[0];
            this.rpMenu.DataBind();

            SUMDT = dt[1];

            this.AddLog(Permission.查看);
        }

        protected string GetUMDTValue(string filename)
        {
            if (SUMDT.Rows.Count <= 0)
            {
                return "0";
            }
            return SUMDT.Rows[0][filename].ToString();
        }
    }
}